package com.oneandone.mamba.mc.model;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

@Entity
public class Transaction extends BaseEntity {

	@Column(name = "primary_account_iban")
	private String primaryAccountIban;

	@Column(name = "secondary_account_iban")
	private String secondaryAccountIban;

	// the name of the person involved in the transfer
	@Column(name = "transfer_person_name")
	private String transferPersonName;

	@Column(name = "transfer_details")
	private String transferDetails;

	@Enumerated(EnumType.STRING)
	private Status status;

	@Column(name = "money_amount")
	private double moneyAmount;

	@OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
	private Set<Operation> operations;

	public static enum Status {
		NEW, PENDING_OPERATION, EXECUTED;
	}

	public String getPrimaryAccountIban() {
		return this.primaryAccountIban;
	}

	public void setPrimaryAccountIban(String primaryAccountIban) {
		this.primaryAccountIban = primaryAccountIban;
	}

	public String getSecondaryAccountIban() {
		return this.secondaryAccountIban;
	}

	public void setSecondaryAccountIban(String secondaryAccountIban) {
		this.secondaryAccountIban = secondaryAccountIban;
	}

	public String getTransferPersonName() {
		return this.transferPersonName;
	}

	public void setTransferPersonName(String transferPersonName) {
		this.transferPersonName = transferPersonName;
	}

	public String getTransferDetails() {
		return this.transferDetails;
	}

	public void setTransferDetails(String transferDetails) {
		this.transferDetails = transferDetails;
	}

	public Status getStatus() {
		return this.status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public double getMoneyAmount() {
		return this.moneyAmount;
	}

	public void setMoneyAmount(double moneyAmount) {
		this.moneyAmount = moneyAmount;
	}

	public Set<Operation> getOperations() {
		return this.operations;
	}

	public void setOperations(Set<Operation> operations) {
		this.operations = operations;
	}

}
